package cn.ac.big.bigd.model;

import cn.ac.big.bigd.model.submit.Submission;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.*;
import java.util.Date;
import java.util.List;
@ToString
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class User {

    private static final long serialVersionUID = -3518053163206292711L;

    public static final String DEFAULT_PASSWORD = "123456";
    @JsonIgnore
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid2")
    String id;


    String casId;

    @NotBlank
    String email;
    @NotBlank
    String username;
    @NotBlank
    @JsonIgnore
    String password;

    String fullName;

    String phone;//电话号码
    @JsonIgnore
    Boolean accountNonExpired = true;
    @JsonIgnore
    Boolean accountNonLocked = true;
    @JsonIgnore
    Boolean credentialsNonExpired = true;
    Boolean enabled = true;

    @JsonFormat(pattern = "yyyy-MM-dd")
    Date createdAt;
    @JsonIgnore
    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "userId", referencedColumnName = "id")
    private List<Submission> submissionList;


    private String organization;//机构

    private String userdepartment;//部门
    private String country;//国家
    private String city;//城市
    private String postalCode;//邮编
    private String detailedAddress;//地址












}
